package com.ccc.netty.server.splitpacket.service;

import com.ccc.netty.server.splitpacket.pojo.MyMsgProtocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * 业务数据处理
 *
 * @author superC
 * @version 1.0.0
 * @date 2022/8/4
 */

@Service
public class BusinessDataService {
    protected static final Logger logger = LoggerFactory.getLogger(BusinessDataService.class);

    public void process(MyMsgProtocol myMsgProtocol) {
        try {
            logger.info("=======起始标识符为：{}", myMsgProtocol.getStartId());
            logger.info("=======消息类型为：{}", myMsgProtocol.getType());
            logger.info("=======数据体长度为：{}", myMsgProtocol.getLen());
            logger.info("=======消息序列号为：{}", myMsgProtocol.getId());
            // 处理图片
            InputStream inputStream = new ByteArrayInputStream(myMsgProtocol.getContent());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}